<form method="post" action="${rc.getContextPath()}/manage/message/saveMessage" class="pageForm required-validate" onsubmit="return tsubmit(this);">
    <div class="pageContent">
        <div class="pageFormContent">
            <input type="hidden" name="navTabId" value="${navTabId!''}"> <input type="hidden" name="id" value="<#if (message.messageCode)??>${message.messageCode!''}</#if>">
            <fieldset>
                <dl class="nowrap">
                    <p>
                        <label><@label key="messageCode.C,colon">消息编码：</@label></label> <input name="messageCode" value="<#if (message.messageCode)??>${message.messageCode!''}</#if>" size="32" type="text" maxlength="40" class="required  alphanumeric toUp"<#if (message.messageCode)??> readonly="readonly"<#else> remote="${rc.getContextPath()}/manage/message/validateMessageCode"</#if> warn="<@label key="messageCodeExist.M">消息编号已经存在</@label>"/>
                    </p>
                </dl>
                <dl class="nowrap">
                    <dd>
                        <input type="hidden" id="messageContents" name="messageContents" />
                        <div class="tabs" currentIndex="0" eventType="click" style="width: 560px">
                            <div class="tabsHeader">
                                <div class="tabsHeaderContent">
                                    <ul>
                                        <li><a href="javascript:;"><span><@label key="default.C">默认</@label></span> </a>
                                        </li> <#if (contents?size>0)> <#list contents as content>
                                        <li><a href="javascript:;"><span>${content.languageName!''}</span> </a>
                                        </li> </#list></#if>
                                    </ul>
                                </div>
                            </div>
                            <div id="tabcontent" class="tabsContent">
                                <div>
                                    <textarea style="height: 55px;" class="required" id="messageContent" cols="83" rows="5" name="messageContent"><#if (message.messageContent)??>${message.messageContent!''}</#if></textarea>
                                    <label style="width: 500px;"><@label key="contentNote.C">注：消息内容中需要以参数替换的部分，请以${0}、${1}、${2}……形式替代！</@label></label>
                                </div>
                                <#if (contents?size>0)> <#list contents as content>
                                <div>
                                    <textarea style="height: 55px;" cols="83" rows="5"><#if (content.messageContent)??>${content.messageContent!''}</#if></textarea>
                                    <label style="width: 500px;"><@label key="contentNote.C">注：消息内容中需要以参数替换的部分，请以${0}、${1}、${2}……形式替代！</@label></label>
                                </div>
                                </#list></#if>
                            </div>
                            <div class="tabsFooter">
                                <div class="tabsFooterContent"></div>
                            </div>
                    </dd>
                </dl>
                <dl class="nowrap">
                    <dd>
                        <div class="panel" style="margin: 0;">
                            <h1><@label key="sendMode.C">发送方式</@label></h1>
                            <div style="width: 550px;">
                                <label><input id="instantMessageFlag" type="checkbox" name="instantMessageFlag" value="1"<#if (message.instantMessageFlag)?? && (message.instantMessageFlag == 1)> checked="true"</#if>><@label key="instantMessageFlag.C">站内消息</@label></label> 
                                <label><input type="checkbox" id="emailMessageFlag" name="emailMessageFlag" value="1"<#if (message.emailMessageFlag)?? && (message.emailMessageFlag == 1)> checked="true"</#if>><@label key="emailMessageFlag.C">邮件消息</@label></label> 
                                <label><input type="checkbox" id="shortMessageFlag" name="shortMessageFlag" value="1"<#if (message.shortMessageFlag)?? && (message.shortMessageFlag == 1)> checked="true"</#if>><@label key="shortMessageFlag.C">手机短信</@label></label>
                            	<label><input type="checkbox" id="wechatMessageFlag" name="wechatMessageFlag" value="1"<#if (message.wechatMessageFlag)?? && (message.wechatMessageFlag == 1)> checked="true"</#if>><@label key="wechatMessageFlag.C">微信消息</@label></label>
                            	<label><input type="checkbox" id="smartWatchMessageFlag" name="smartWatchMessageFlag" value="1"<#if (message.smartWatchMessageFlag)?? && (message.smartWatchMessageFlag == 1)> checked="true"</#if>><@label key="smartWatchMessageFlag.C">智能手表消息</@label></label>
                            </div>
                    </dd>
                </dl>
                <dl class="nowrap">
                    <dd>
                        <div class="panel" style="margin: 0;">
                            <h1><@label key="sendee.C">接收人</@label></h1>
                            <div style="width: 550px;">
                                <p style="width: 420px">
                                    <label><@label key="user.C,colon">用户：</@label></label> <input id="receiverUser" name="receiverUser" value="<#if (message.receiverUser)??>${message.receiverUser!''}</#if>" type="hidden" /> <input id="inputUserCode" name="user.id" value="<#if (message.receiverUser)??>${message.receiverUser!''}</#if>" type="hidden" /> <input class="look" id="receiverUserName" size="32" readonly="readonly" name="user.name" type="text" value="<#if (message.receiverUserName)??>${message.receiverUserName!''}</#if>" /><a class="btnLook" width="640" height="500" href="${rc.getContextPath()}/manage/role/selectUser?navTabId=${navTabId!''}" lookupGroup="user"></a> <a href="javascript:" class="deletebtn" onclick="userdel()"></a>
                                </p>
                                <p style="width: 420px">
                                    <label><@label key="role.C,colon">角色：</@label></label> <input id="receiverRole" name="receiverRole" value="<#if (message.receiverRole)??>${message.receiverRole!''}</#if>" type="hidden" /> <input id="inputReceiverRole" name="role.id" value="<#if (message.receiverRole)??>${message.receiverRole!''}</#if>" type="hidden" /> <input class="look" id="receiverRoleName" size="32" readonly="readonly" name="role.name" type="text" value="<#if (message.receiverRoleName)??>${message.receiverRoleName!''}</#if>" />  <a class="btnLook" width="640" height="500" href="${rc.getContextPath()}/manage/user/selectRole?navTabId=${navTabId!''}" lookupGroup="role"></a><a href="javascript:" class="deletebtn" onclick="roledel()"></a>
                                </p>
                                <p style="width: 420px">
                                    <label><@label key="organization.C,colon">组织：</@label></label> <input id="receiverOrg" name=receiverOrg value="<#if (message.receiverOrg)??>${message.receiverOrg!''}</#if>" type="hidden" /> <input id="inputReceiverOrg" name="org.id" value="<#if (message.receiverOrg)??>${message.receiverOrg!''}</#if>" type="hidden" /> <input class="look" id="receiverOrgName" size="32" readonly="readonly" name="org.name" type="text" value="<#if (message.receiverOrgName)??>${message.receiverOrgName!''}</#if>" /> <a class="btnLook" width="640" height="500" href="${rc.getContextPath()}/manage/user/selectOrg?navTabId=${navTabId!''}" lookupGroup="org"></a> <a href="javascript:" class="deletebtn" onclick="orgdel()"></a>
                                </p>
                            </div>
                    </dd>
                </dl>

            </fieldset>
        </div>
        <#if (message.messageCode)??> <#assign createInfo=message/> <#include "/common/createInfo.html"> </#if>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit"><@label key="save.B">保存</@label></button>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="buttonActiveGrey">
                        <div class="buttonContent">
                            <button type="button" class="close"><@label key="cancel.B">取消</@label></button>
                        </div>
                    </div></li>
            </ul>
        </div>
    </div>
</form>
<script type="text/javascript">
    function userdel()
    {
        $("#receiverUser").val("");
        $("#inputReceiverOrg").val("");
        $("#receiverUserName").val("");
    }
    function roledel()
    {
        $("#receiverRole").val("");
        $("#inputReceiverRole").val("");
        $("#receiverRoleName").val("");
    }
    
    function orgdel()
    {
        $("#receiverOrg").val("");
        $("#inputReceiverOrg").val("");
        $("#receiverOrgName").val("");
    }
    
     function tsubmit(t)
     {
         $("#receiverUser").val($("#inputUserCode").val());
         $("#receiverRole").val($("#inputReceiverRole").val());
         $("#receiverOrg").val($("#inputReceiverOrg").val());
         var content="";
          $('#tabcontent textarea',$.pdialog.getCurrent()).each(function (i, e) {
              var obj = $(e);
              if(e.name!="messageContent")
            {
              var c=" ";
              if(obj.val().length>0)
                  {
                  c=obj.val();
                  }
              content+=c+"[&]";
           }
          });
          content=content.substring(0,content.length - 3);
          $("#messageContents").val(content);
          if(typeof($('#instantMessageFlag').attr("checked"))=="undefined"
        		  &&typeof($('#emailMessageFlag').attr("checked"))=="undefined"
        		  &&typeof($('#shortMessageFlag').attr("checked"))=="undefined"
       			  &&typeof($('#wechatMessageFlag').attr("checked"))=="undefined"
     		      &&typeof($('#smartWatchMessageFlag').attr("checked"))=="undefined")
              {
              alertMsg.warn('<@label key="sentModeTip.M">请至少选择一种发送方式！</@label>')
              return false;
              }
         /* if($("#receiverUserName").val()==""&&$("#receiverRoleName").val()==""&&$("#receiverOrgName").val()=="")
              {
              alertMsg.warn('<@label key="receiverTip.M">请至少选择一个接收人！</@label>')
              return false;
              }*/
         return validateCallback(t, dialogAjaxDone);
     }
     
    </script>